package com.gxwz.document.business.service.impl;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import com.gxwz.document.business.service.IdocService;
import com.gxwz.document.business.dao.IdocDao;
import com.gxwz.document.business.entity.Document;

public class DocServiceImpl implements IdocService {
	@Autowired
 	private IdocDao docDAO;

	@Override
	public void saveFileInfo(String upLoadFileName, String path, double filesize, String newName, String fileType) {
		Date date=new Date();   //获取当前系统时间
		DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
   		String time = format.format(date); 
   		Timestamp Time = Timestamp.valueOf(time);//把String 类型转换成 Timestamp 类型
   		Document doc =new Document();
   		doc.setDocDates(Time);
   		doc.setDocPath(path);
   		doc.setDocName(upLoadFileName);
   		doc.setDocSize(filesize);
   		/*doc.setDocId(docId);*/
   		doc.setDocType(fileType);
   		docDAO.save(doc);
		
	}
}
